<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%><?xml version="1.0"?>
<%@page import="com.alibaba.aliper.server.model.interfaces.AliperView"%>
<%@page import="com.alibaba.aliper.server.model.interfaces.AgentView"%>
<%@page import="com.alibaba.aliper.server.model.interfaces.ChartView"%>
<%@page import="com.alibaba.aliper.server.model.interfaces.LineView"%>
<%@page import="com.alibaba.aliper.server.model.impl.AliperServer"%>
<%@page import="com.alibaba.aliper.server.model.domain.Point"%>
<%
	//重要，jschart只接受text/xml类型的数据文件
   response.setContentType("text/xml");
	String agentId = request.getParameter("agent");
	String chartId = request.getParameter("chart");
	AliperView aliper = AliperServer.getAliperServer();
	ChartView chart = aliper.getAgent(agentId).getChart(chartId);
%>
<JSChart>
<%
for(LineView line : chart.getLines()){
%>
<dataset type="line" id="<%=line.getId()%>">
<%
for(Point point : line.getPoints()){
%>
	<data unit="<%=point.getX()%>" value="<%=point.getY()%>"/>
<%
}
%>
</dataset>
<%
}    
%>
	<optionset>
		<option set="setLineColor" value="'#8D9386'"/>
		<option set="setLineWidth" value="2"/>
		<option set="setTitleColor" value="'#7D7D7D'"/>
		<option set="setAxisColor" value="'#9F0505'"/>
		<option set="setGridColor" value="'#a4a4a4'"/>
		<option set="setAxisValuesColor" value="'#333639'"/>
		<option set="setAxisNameColor" value="'#333639'"/>
		<option set="setTextPaddingLeft" value="0"/>
		<option set="setSize" value="600,300"/>
		<option set="setTitle" value="'cpu'"/>
		<option set="setIntervalEndY" value="100"/>
		<option set="setIntervalStartY" value="0"/>
	</optionset>
</JSChart>